import jwt
from flask import current_app
from datetime import datetime,timedelta
def gen_toen(payload):
    key = current_app.config.get('SERCET_KEY')

    token = jwt.encode(payload, key, algorithm='HS256')
    return token

def check_token(token):
    key = current_app.config.get('SERCET_KEY')
    payload = jwt.decode(token,key,algorithms=['HS256'])
    return payload